<?php include "header.html"; ?>

<body>
	<div class="zss-wrap">

		<div class="zss-header">
			<span class="layui-breadcrumb">
				<?= $this->get_loc($this->baseClass, "编辑"); ?>
			</span>
		</div>

		<div class="zss-nav">
			<a type="button" class="layui-btn" href="<?= U($this->baseClass, $this->getArgs()) ?>">
				<i class="layui-icon layui-icon-return"></i> 返回 
			</a>
		</div>

		<div class="zss-content">

			<div class="layui-tab layui-tab-brief">
				<ul class="layui-tab-title">
					<a href="admin.php"><li class="layui-this">添加管理组</li></a>
				</ul>
			</div>

			<div class="zss-form-box">
				<form action="<?= U($this->baseClass . '/submit', $this->getArgs()) ?>" method="post" class="layui-form">
					<div class="layui-form-item">
						<label class="layui-form-label">名称</label>
						<div class="layui-input-block">
							<input type="text" name="group_name" lay-verify="required" placeholder="" autocomplete="off" class="layui-input" value="<?= $row['group_name'] ?>">
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">描述</label>
						<div class="layui-input-block">
							<textarea name="group_desc" placeholder="请输入内容" class="layui-textarea"><?= $row['group_desc'] ?></textarea>
						</div>
					</div>

					<div class="layui-form-item">
						<label class="layui-form-label">添加时间</label>
						<div class="layui-input-block">
							<input type="text" name="group_time" placeholder="" autocomplete="off" class="layui-input" value="<?= $row['group_time'] ? date('Y-m-d H:i:s', $row['group_time']) : date('Y-m-d H:i:s') ?>" id="input_time">
						</div>
					</div>

					
					<fieldset class="layui-elem-field layui-field-title">
						<legend style="margin: auto; font-size: 16px;">管理人员权限设置</legend>
					</fieldset>

					<?php
					
					foreach($global["menu"] as $val) {
						if($val["child"] || $val["power"]) {
					?>
					<div class="layui-form-item">
						<label class="layui-form-label"><?= $val["name"] ?></label>
						<div class="layui-input-block">
							<?php $this->group_list($val, $row['group_id']); ?>
						</div>
					</div>
						<?php }?>
					<?php }?>

					<div class="layui-form-item">
						<div class="layui-input-block">
						  <input type="hidden" value="<?= $global['id'] ?>" name="id" />
						  <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>

	<script>
		layui.use(['element', 'form', 'laydate'], function() {
			var laydate = layui.laydate;
			//执行一个laydate实例
			laydate.render({
				elem: '#input_time' //指定元素
				,type: 'datetime'
			});
		});
	</script>
</body>
</html>
